Handle explicit empty database batches#19036
Closed
trask wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates shared DB semconv handling to treat explicit empty batches (db.operation.batch.size = 0) as batches for stable span names and db.query.summary. Previously, only batchSize > 1 was considered a batch; now any non-null, non-one value triggers batch behavior. The PR also extends MultiQuery to track per-query operation names and collection names for the singleOperationAndCollection feature.
Changes:
- Updated batch condition from
batchSize > 1tobatchSize != 1consistently acrossDbClientAttributesExtractor,SqlClientAttributesExtractor, andDbClientSpanNameExtractor. - Extended
MultiQuerywithoperationName/collectionNamefields and emitted them in the multi-query path whensingleOperationAndCollectionis enabled. - Added comprehensive test coverage for empty batch (batchSize=0) scenarios and the multi-query
singleOperationAndCollectionbehavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
DbClientAttributesExtractor.java |
Updated batch condition to batchSize != 1; renamed intermediate variable to emitBatchSize for clarity. |
SqlClientAttributesExtractor.java |
Same batch condition update; added DB_OPERATION_NAME/DB_COLLECTION_NAME emission from MultiQuery in multi-query path. |
DbClientSpanNameExtractor.java |
Updated isBatch() method to treat size 0 as batch; added early "BATCH" return for empty query texts in batch context. |
MultiQuery.java |
Added operationName/collectionName fields, builder tracking via UniqueValue, and "BATCH"-prefixed construction in build(). |
SqlClientAttributesExtractorTest.java |
Added tests for empty batch attributes and multi-query batch with singleOperationAndCollection. |
DbClientSpanNameExtractorTest.java |
Added tests for empty batch span names and default mock setup for batch size. |
Member
Author
|
Closing, going to focus on getting the test-only improvements in first, then come back and add this so we can see effect on tests at the same time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Core behavioral changes from #19019, reflecting clarification in open-telemetry/semantic-conventions#3811.
This updates shared DB semconv handling so explicit empty batches (
db.operation.batch.size = 0) are treated as batches for stable span names anddb.query.summary.